<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2024/9/10
  Time: 15:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.css">
    <script src="${pageContext.request.contextPath}/js/jquery-3.3.1.js"/>
    <script src="${pageContext.request.contextPath}/js/bootstrap.js"/>
</head>
<body>
啊啊啊
    <!-- 导航栏 -->
    <div class="row">
        <div class="col-md-2"></div>
        <div class="col-md-8">
            <nav class="navbar navbar-default" role="navigation">
                <div class="container-fluid">
                    <div class="navbar-header">
                        <a class="navbar-brand" href="#">学生信息管理系统</a>
                    </div>
                    <div>
                        <ul class="nav navbar-nav">
                            <li ><a href="#">管理员管理</a></li>
                            <li class="active"><a href="#">老师管理</a></li>
                            <li><a href="#">学生管理</a></li>
                        </ul>
                    </div>
                </div>
            </nav>
        </div>
        <div class="col-md-2"></div>
    </div>
    <div class="row">
        <div class="col-md-2">
            <div class="col-md-8">
            <div class="row">
                <div class="col-md-8">
                    <div class="input-group">
                        <input type="text" id="search" class="form-control" placeholder="">
                        <span class="input-group-addon">检索</span>
                    </div>
                </div>
                <div>
                    <button type="button" class="btn btn-primary">添加</button>
                </div>
            </div>
                <table class="table table-stripe table-bordered table-hover">
                    <thead>
                    <tr>
                        <th>序号</th>
                        <th>姓名</th>
                        <th>性别</th>
                        <th>电话</th>
                        <th>年龄</th>
                    </tr>
                    </thead>
                    <tbody id="bg">
                    <tr>
                        <td>Tanmay</td>
                        <td>Bangalore</td>
                        <td>Bangalore</td>
                        <td>Bangalore</td>
                        <td>Bangalore</td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <div class="col-md-8"></div>
        <div class="col-md-2"></div>
    </div>
<script>
    var pageIndex = 1;
    var pageSize = 10;
    selectAll();
    function selectAll() {
        var name = $("#search").val();
        $.ajax({
            url: "/selectAll",
            data: {
                name: name,
                pageIndex: pageIndex,
                pageSize:pageSize
            },
            method:"get",
            success: function (data) {
                html = "";
                //接收list
                $.each(data, function (index, res) {
                    html += '<tr>' +
                            '<td>' + res.id + '</td>' +
                            '<td>' + res.name + '</td>' +
                            '<td>' + res.sex + '</td>' +
                            '<td>' + res.phone + '</td>' +
                            '<td>' + res.age + '</td>' +
                            '</td>' +
                            '<button type="button" class="btn btn-warning"> 修改</button>' +
                            '<button type="button" class="btn btn-warning"> 删除</button>' +
                            '</td>' +
                    '</tr>'
                })
                $("#bg").html(html);
            }
        })
    }
</script>
</body>
</html>
